import java.util.Arrays;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 高生平
 * Date: 2025-09-12
 * Time: 21:11
 */
public class Test {
    public static void comeBefore (int[] array){
        int left = 0;
        int right = array.length - 1;
        while (left < right) {
            while (left < right && array[left] % 2 != 0) {
                left++;
            }
            while (left < right && array[right] % 2 == 0) {
                right--;
            }
            int tmp = array[left];
            array[left] = array[right];
            array[right] = tmp;
        }
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int[] array = new int[k];
        for (int i = 0; i < k; i++) {
            array [i] = sc.nextInt();
        }
        comeBefore(array);
        System.out.println(Arrays.toString(array));
    }
}
